﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>广告列表</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="/style/admin/style/adminStyle.css" rel="stylesheet" type="text/css" />
        <script src="/style/admin/js/jquery.js"></script>
        <script src="/style/admin/js/public.js"></script>
        <style>
            td{
                text-align: center;
            }
            ul, li { 
                float: left;
            }
            .active,.disabled{
                width:30px;
                height:30px;
                line-height: 30px;
                background: white;
            }
        </style>
    </head>
    <body>
        <div class="wrap">
            <div class="page-title">
                <span class="modular fl"><i></i><em>轮播图列表</em></span>
                <span class="modular fr"><a href="/admin/ads/ads_add" class="pt-link-btn">+添加广告</a></span>
            </div>
            <table class="list-style Interlaced">
                <tr>
                    <th>广告名称</th>
                    <th>链接</th>
                    <th>排序</th>
                    <th>图片</th>
                    <th>操作</th>
                </tr>
                @foreach($data as $value)
                <tr>
                    <td>{{$value->title}}</td>
                    <td>{{$value->href}}</td>
                    <td>{{$value->sort}}</td>
                    <td><img src="{{$value->img}}" style="width:200px;" /></td>
                    <td class="center">
                        <a href="/admin/ads/edit/{{{$value->id}}}" title="编辑"><img src="/style/admin/images/icon_edit.gif"/></a>
                        <a title="删除" href="javascript::;" onclick="del({{$value->id}})"><img src="/style/admin/images/icon_drop.gif"/></a>
                    </td>
                </tr>
                @endforeach
            </table>
            <!-- BatchOperation -->
            <div style="overflow:hidden;">
                <!-- Operation -->
                <!--                <div class="BatchOperation fl">
                                    <input type="checkbox" id="del"/>
                                    <label for="del" class="btnStyle middle">全选</label>
                                    <input type="button" value="批量删除" class="btnStyle"/>
                                </div>-->
                <!-- turn page -->
                <div class="turnPage center fr">
                    {{$data->links()}}
                </div>
            </div>
        </div>
        <script>
            //定义删除方法
            function del(id){
            $.post("/admin/ads/del/" + id, {'_token':"{{csrf_token()}}", "_method":'delete'}, function(data){
            if (data == 1){
            window.location.reload();
            } else{
            alert("删除失败");
            }
            })
            }
        </script>
    </body>
</html>